﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Linq;
using System.Text;

using InfFront.UICore;
using InfFront.InfoSources.Base;
using InfFront.InfoViews.Base;

namespace InfFront.InfoViews.WPF.Settings
{
    internal partial class InfoCommandSettingsInfoSource : SingleObjectInfoSource
    {
        #region Private Variables
        private InfoViewCommand viewCommand = null;
        #endregion Private Variables

        public InfoCommandSettingsInfoSource()
        {
            InitializeComponent();
        }

        public InfoCommandSettingsInfoSource(IContainer container)
        {
            container.Add(this);

            InitializeComponent();
        }

        [Browsable(false), DefaultValue(null)]
        public InfoViewCommand ViewCommand
        {
            get { return viewCommand; }
            set 
            { 
                viewCommand = value;
                if (value != null)
                {
                    Title = value.Title;
                    Name = "__command__" + value.Name;
                }
            }
        }

        private void this_OnGetObject(object sender, GetObjectEventArgs args)
        {
            args.Object = ViewCommand;
        }
    }
}
